<template>
  <RTHeader label="签约环节" :statusInfo="statusInfo"></RTHeader>
  <component v-if="statusInfo.component" :is="statusInfo.component" @surrender="surrender" @dieOut="dieOut"></component>
</template>

<script setup lang='ts'>
import { ref, watch } from "vue";
import RTHeader from '../../RTHeader.vue';
import ContractTobeOffer from "./ContractComponent/ContractTobeOffer.vue";
import ContractWattingSign from "./ContractComponent/ContractWattingSign.vue";
import ContractSurrender from "./ContractComponent/ContractSurrender.vue";
import ContractParties from "./ContractComponent/ContractParties.vue";
import ContractSecondInterview from "./ContractComponent/ContractSecondInterview.vue";
import ContractSecondInterviewPass from "./ContractComponent/ContractSecondInterviewPass.vue";
import EntrySurrender from "../Entry/EntryComponent/EntrySurrender.vue";
const props = defineProps(['trainStatus']);
const statusInfo = ref<any>({
})
const trainStatus = {
  // "待发Offer": {
  //   component: ContractTobeOffer,
  // },
  "待签应约": {
    component: ContractWattingSign
  },
  "待签应约-放弃": {
    component: ContractSurrender
  },
  "待签三方": {
    component: ContractParties
  },

  "待签三方-放弃": {
    component: EntrySurrender
  },
  "二次面试": {
    component: ContractSecondInterview
  },
  "二次面试-通过": {
    component: ContractSecondInterviewPass
  },
  "二次面试-淘汰": {

  },
  "二次面试-放弃": {

  },

}
for (const key in trainStatus) {
  const el = trainStatus[key];
  el.status = key
  el.hr = "王xx" + key
  el.count = 1
}
watch(() => props.trainStatus, (val) => {
  statusInfo.value = trainStatus[val];
}, { immediate: true })
const emits = defineEmits(['surrender', 'dieOut'])
const surrender = (val) => {
  emits('surrender', val)
}

const dieOut = (val) => {
  emits('dieOut', val)
}
</script>
<style lang="less" scoped>
.btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
</style>